<template>
	 <div class="box" style="width: 100%;">
	 <!-- 头部导航 -->
	<el-menu
	  :default-active="activeIndex2"
	  class="el-menu-demo"
	  mode="horizontal"
	  @select="handleSelect"
	  background-color="#D1C2D8"
	  text-color="#fff"
	  active-text-color="#ffd04b">
	   <el-link @click="welcome()" style="float: left;" target="_blank"><p style="color: white;font-size: 20px;">慧点众筹交易平台</p></el-link>
		 <el-link @click="login()"  style="float: left;margin-left: 70%;"><p style="color: white;font-size: 20px;" v-show="showdenglu">登录</p></el-link>
	  <el-submenu v-show="showUser" style="float: right;" index="1">		  
	    <template slot="title">{{user}}</template>
	    <el-menu-item index="1-1" @click="user1()">我的</el-menu-item>
	    <el-menu-item index="1-2" @click="welcome()">首页</el-menu-item>
	    <el-menu-item index="1-3" @click="logout()">注销</el-menu-item>
	  </el-submenu>
	</el-menu>
	 <div class="main" >
	 	<router-view ></router-view>
	 </div>
	 
	 <div class="foot">
	 		<div style="text-align: center;"> 
				  <hr><el-link type="primary">关于我们</el-link><p style="font-size: 5px;display: inline;">&nbsp;|&nbsp;</p> 				     
				  <el-link type="primary">服务条款</el-link><p style="font-size: 5px;display: inline;">&nbsp;|&nbsp;</p>
				  <el-link type="primary">免责声明</el-link><p style="font-size: 5px;display: inline;">&nbsp;|&nbsp;</p> 
				  <el-link type="primary">网站地图</el-link><p style="font-size: 5px;display: inline;">&nbsp;|&nbsp;</p>
				  <el-link type="primary">联系我们</el-link>
	 		 
			 <p style="font-size: 5px;">Copyright ?2017-2017layoutit.cn 版权所有</p>
			</div>
	 </div>
	 </div>
	 
	
</template>

<script>
	export default {
		data(){
			return{
				showdenglu:true,
				showUser:false,
				user:''
			}
		},
	methods:{
		
		 // 注销
		 logout(){
		 	window.sessionStorage.clear();
			this.zs();
		 	this.$router.push('/login');
			
		 },
		 //用户界面
		  user1(){
		  	this.$router.push('/user')
		  },
		  //登录
		  login() {
		  	this.$router.push('/login')
		  },
		  // 实名认证
		  
		  // 默认展示
		 welcome(){
			 
		 	this.$router.push('/welcome')
		 },
		// 项目展示
		zs() {
			var token = window.sessionStorage.getItem("token");
														
					if(token!=null){
						// alert("iiii")
						var user = window.sessionStorage.getItem("userq");
						// var user = decodeURIComponent(user1);
						
						this.user = user		
						this.showUser = true
						this.showdenglu = false
					}else{
						// alert("eeee")
						this.showUser = false
						this.showdenglu = true
					}
					
				
		},
		// 项目展示
		username() {
			var user1 = window.sessionStorage.getItem("userq");
			var user = decodeURIComponent(user1);
			this.user = user										
		}
	},
	mounted(){	
				
		        this.zs()				
				this.welcome();
				
			}
	}
</script>

<style >
	.box{
		width: 100%;
		box-sizing: border-box;
		overflow-x: hidden;
	}
	.main{
		width: 80%;
		margin:0 auto;
		background-color: white; 
		box-sizing:border-box;
		
	}
	.foot{
		width: 75%;
		margin: 0 auto;
		
	}
</style>
